home *** CD-ROM | disk | FTP | other *** search
- program getFunctionKey;
- { A simple way to tell which function key has been pressed on an IBM PC or
- other PC-DOS computer running Turbo Pascal. }
- {$C-$U+}
- var
- ch1,ch2 : char;
- previous : boolean;
- count : integer;
-
- begin
- writeln('Hit 20 keys');
- for count := 1 to 20 do
- begin
- read(kbd,ch1); {read a character, if it is an ESC (chr(27) then}
- if ch1 = chr(27) then {the keystroke must be either an ESC key or one }
- begin {that generates a two digit code }
- previous := true;
- read(kbd,ch1);
- end
- else previous := false;
- if previous then write('ESC ')
- else write('single char ');
- writeln('ord(ch1)= ',ord(ch1));
- end;
-
- end.